<%--
  Created by IntelliJ IDEA.
  User: test123456test
  Date: 2021/6/1
  Time: 21:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <%--    <script src="js/jquery-1.12.4.js"></script>--%>
    <script src="${pageContext.request.contextPath}/js/jquery-1.12.4.js"></script>

    <%--    <script src="${pageContext.request.contextPath}/js/jquery-1.12.4.js"></script>--%>
</head>
<body>
<button onclick="send_json()">提交</button>
<script type="text/javascript">
    function send_json() {
        //1 创建JSON格式 对象
        var user = {"id": 100, "name": "范", "salary": 30.2};
        var str = JSON.stringify(user);
        $.ajax({
            url: "${pageContext.request.contextPath}/json/test4",
            type: "post",
            data: str,
            contentType: "application/json;charset=utf-8",
            success: function (result) {
                alert(result);
            }
        })
    }
</script>
</body>
</html>
